<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Mod_left extends CI_Controller {
    public $rear = '';
    function __construct() {
        parent::__construct();
        if($this->session->userdata('ngonngu') && $this->session->userdata('ngonngu')=='_en') {
            $this->rear = '_en';
            $this->lang->load('atta','english');
        }else{
            $this->lang->load('atta','vietnam');
        } 
    }

    function index() {
        $objectCategories = $this->common_model->getdata('danhmuctt', array('publish' => 1, 'position' => 2), '', array('order', 'ASC'));
        $objectAds = $this->common_model->getdata('quangcao',array('publish'=>1),'',array('id','DESC'),2);
        $objectQuestion = $this->common_model->getdata('hoidap',array('publish'=>1),'',array('id','DESC'));
        
    }

    public function leftProduct() {
        $alias = $this->security->xss_clean($this->uri->segment(1, 0)); //cat duoi html
        $getAlias = $this->common_model->getdata('alias', array('type' => 'tintuc'));
        foreach ($getAlias as $ali) {
            $dataAliastt[$ali->a_id] = $ali;
        }

        $selectDesign = $this->common_model->getdata('danhmucsp', array('publish' => 1));
        $selectAlias = $this->common_model->getdata('alias', array('type' => 'danhmucsp'));
        foreach ($selectAlias as $ali) {
            $dataAlias[$ali->a_id] = $ali;
        }
        $arrayNoteDesign = array();
        if (!empty($selectDesign)) {
            foreach ($selectDesign as $ms) {
                $arrayDesign[$ms->parentid][] = $ms;
            }
            foreach ($arrayDesign[0] as $pp1) {
                if (!empty($arrayDesign[$pp1->id])) {
                    foreach ($arrayDesign[$pp1->id] as $vvv1) {
                        $arrayNoteDesign[] = $vvv1;
                    }
                }
            }
        } else {
            $selectDesign = '';
        }
//var_dump($arrayMenuService[0]);
        $selectNewsHot = $this->common_model->getdata('tintuc', array('publish' => 1, 'noibat' => 1), '', array('id', 'desc'), 15);
        $selectAds = $this->common_model->getone('quangcao', array('publish' => 1, 'position' => 3));
        $dataArticle = array(
            'selectDesign' => $arrayDesign[0],
            'arrayNoteDesign' => $arrayNoteDesign,
            'selectNewsHot' => $selectNewsHot,
            'selectAds' => $selectAds,
            'dataAlias' => $dataAlias,
            'dataAliastt' => $dataAliastt,);
        $this->load->view('mod_collright/view_collright', $dataArticle);
    }

}
